package com.sx.micowell.module.message

import android.opengl.Visibility
import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.mvvm.until.SPUtils
import com.miloyu.modelnet.response.SysNotice
import com.sx.micowell.R
import com.sx.micowell.framework.app.SPKey

/**
 * @Author: YY
 * @Time: 2021/8/13
 * @Describe TODO
 */
class NoticeListAdapter : BaseQuickAdapter<SysNotice, BaseViewHolder>(R.layout.item_message_list) {

    override fun convert(holder: BaseViewHolder, item: SysNotice) {
        if (holder.adapterPosition == 0) {
            if (SPUtils.getInstance().getBoolean(SPKey.SP_UNREAD, true)) {
                holder.getView<View>(R.id.tv_over_red).visibility = View.VISIBLE
            } else {
                holder.getView<View>(R.id.tv_over_red).visibility = View.GONE
            }
        } else {
            holder.getView<View>(R.id.tv_over_red).visibility = View.GONE
        }
        holder.setText(R.id.tv_notices_title, item.noticeTitle)
        holder.setText(R.id.tv_notices_time, item.createTime)
    }
}